/*
 * @Author: your name
 * @Date: 2021-07-20 15:49:43
 * @LastEditTime: 2021-07-20 16:26:07
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath:
 */

export function getGUID() {
	const nowTimestamp = new Date().getTime()

	function formatStrLen(str, len) {
		return (Array(5).fill(len).join('') + str).substr(-len)
	}

	function randomLen(len) {
		return Math.floor(Math.random() * 2 ** len).toString(16)
	}

	return [randomLen(8), randomLen(4), randomLen(4), randomLen(4), formatStrLen(nowTimestamp, 12)].join('-')
}
